package com.itheima.controller;


import com.itheima.bean.jdbc;
import com.itheima.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/book")
@RestController
public class BookController {
    //
//    @Value("${server.port}")
//    private Integer port;
//    @Value("${lesson}")
//    private String username;
//    @Value("${jdbc.driver}")
//    private String driver;
//    //@Value 注解只能读取单一元素
//    @Value("${jdbc.subject[1]}")
//    private String[] sub;
//    @Autowired
//    private Environment env; //properties 集合

    @Autowired
    private BookService bookService;
    @Autowired
    private jdbc jdbc;
    @GetMapping("/getById")
    public String getById(Integer id) {
//        System.out.println("端口号:"+ port);
//        System.out.println("项目名称" + username);
//        System.out.println("数据库驱动" + driver);
//        System.out.println("id========>" + id);
//        System.out.println("数组取值" + sub[0]);
//        System.out.println(env.getProperty("lesson"));
//        System.out.println(env.getProperty("server.port"));
//        System.out.println(env.getProperty("jdbc.subject[0]"));
        System.out.println(jdbc);
        return "hello,springboot";
    }
}
